/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.protocol.passive;

import info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanNeedPassword;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanStubStartMode;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.*;

/**
 * <b>(DianlanStubApplyCharge)</b>
 * <p>
 * 充电桩主动申请启动充电
 * 帧类型码 0x31
 * 序列号域 0004
 * 数据长度 37(55)
 * 帧校验域 F496
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/8/11
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class DianlanStubApplyCharge {
    /** 桩编码 */
    @DianlanProtocol(length = 7, start = 0, end = 7, dataType = BCD)
    String               stubNo;
    /** 充电枪号 */
    @DianlanProtocol(length = 1, start = 7, end = 8, dataType = BCD)
    String               chargingPortNo;
    /** 启动方式 */
    @DianlanProtocol(length = 1, start = 8, end = 9, dataType = ENUM)
    DianlanStubStartMode startMode;
    /** 是否需要密码 */
    @DianlanProtocol(length = 1, start = 9, end = 10, dataType = ENUM)
    DianlanNeedPassword  needPassword;
    /** 账号或者物理卡号 不足 8 位补 0 */
    @DianlanProtocol(length = 8, start = 10, end = 18, dataType = BIN)
    String               accountNo;
    /** 输入密码 对客户输入的密码进行16 位MD5加密，采用小写上传 */
    @DianlanProtocol(length = 16, start = 18, end = 34, dataType = BIN)
    String               password;
    /** VIN码 启动方式为vin码启动充电时上送,其他方式置零(ASCII码)，VIN码需要反序上送 */
    @DianlanProtocol(length = 17, start = 34, end = 51, dataType = ASCII)
    String               vin;
}